﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PhoneBook
{
    /**
     * Class representing a group.
     * @author Occello Audrey
     *
     */
    public class Group
    {
        private List<Contact> groupList;
        private String groupName;

        public Group(String name)
        {
            groupName = name;
            groupList = new List<Contact>();
        }
        public Group(List<Contact> gp, String name)
        {
            groupName = name;
            groupList = gp;
        }

        public List<Contact> getGroupList()
        {
            return groupList;
        }

        public Boolean addToGroup(Contact c)
        {
            if (groupList.Contains(c)) return false;
            groupList.Add(c);
            return true;
        }

        public Boolean removeFromGroup(Contact c)
        {
            if (!groupList.Contains(c)) return false;
            return groupList.Remove(c);
        }

        public String getGroupName()
        {
            return groupName;
        }

        public override String ToString()
        {
            return groupName;
        }
    }
}